package cn.smdq.ch.upms.admin.base.controller;


import cn.smdq.ch.common.util.ResultUtil;
import cn.smdq.ch.common.vo.Result;
import cn.smdq.ch.common.vo.UserVO;
import cn.smdq.ch.upms.admin.base.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author shuimo@danqing
 * @since 2019-01-18
 */
@RestController
@RequestMapping("/user")
@Api(value = "系统用户管理",tags = "系统用户管理")
public class UserController {

    private IUserService userService;

    public UserController(IUserService userService) {
        this.userService = userService;
    }

    @GetMapping("/findUserByUsername/{username}")
    @ApiOperation(value = "根据用户名查询用户信息")
    public UserVO findUserByUsername(@PathVariable String username) {
        return userService.findUserByUserName(username);
    }

    @PostMapping
    @ApiOperation(value = "添加用户")
    public Result create(UserVO userVO) {
        return ResultUtil.ok();
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除用户")
    public Result delete(@PathVariable Integer id) {
        return ResultUtil.ok();
    }

    @PutMapping("/{id}")
    @ApiOperation(value = "更新用户")
    public Result update(@PathVariable Integer id, @RequestBody UserVO userVO) {
        return ResultUtil.ok();
    }

    @GetMapping
    @ApiOperation(value = "查询所有用户信息")
    public Result list() {
        return ResultUtil.ok();
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据用户id查询信息")
    public Result get(@PathVariable Integer id) {
        return ResultUtil.ok();
    }

}

